package com.atguigu.daijia.driver.chain.impl;

import com.atguigu.daijia.dispatch.client.NewOrderFeignClient;
import com.atguigu.daijia.driver.chain.StartServiceChain;
import com.atguigu.daijia.driver.chain.StopServiceChain;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * @author 山顶洞人郑某
 * @className DispatchChainImpl.java 新订单服务相关责任链
 * @date 2024 09 13
 */
@Component
@Order(3)
public class DispatchChainImpl implements StartServiceChain, StopServiceChain {
    @Autowired
    private NewOrderFeignClient newOrderFeignClient;
    /**
     * 开始接单后当前服务要执行的内容
     *
     * @param driverId
     */
    @Override
    public void startService(Long driverId) {
        //清楚司机接单队列缓存
        newOrderFeignClient.clearNewOrderQueueData(driverId);
    }

    /**
     * 停止接单服务后各服务需要做的业务
     *
     * @param driverId
     */
    @Override
    public void stopService(Long driverId) {
        //清空司机临时队列
        newOrderFeignClient.clearNewOrderQueueData(driverId);
    }
}
